<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
    <style>
        #img{
            display: inline-block;
            width: 20px;
            height: 20px;
        }
        .open{
            background: url(./images/star-open.png) no-repeat;
            background-size: 100% 100%;
        }
        .close{
            background: url(./images/star-close.png) no-repeat;
            background-size: 100% 100%;
        }
    </style>
</head>
<body>
    <div id="app">
        <div v-for="service in services">
            <span>{{ service.title }}</span>
            <span id="img" v-for="n in 5" :class="service.score | starClass(n)"></span>
            <span>{{ service.score }}</span>
        </div>
    </div>
</body>
<script>
    new Vue({
        el:'#app',
        data:{
            services:[
                {
                    title:'快递包装',
                    score:3.6
                },
                {
                    title:'送货速度',
                    score:4.7
                },
                {
                    title:'服务态度',
                    score:3.8
                }
            ]
        },
        filters:{
            starClass(target,n){
                return n<=Math.ceil(target) ? 'open' : 'close'
            }
        }
    })
</script>
</html>